//
//  ICMBalanceMaintenanceAndPartsView.h
//  ICrEAM
//
//  Created by Cty on 2016/11/03.
//  Copyright © 2016年 mac. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ICMTitleTextFeildView.h"
#import "ICMBalanceBasicInfoModel.h"
#import "ICMLevelView.h"
#import "ICMRepairEventAndPartSearchViewController.h"

@class ICMRepairMaintenancesModel,ICMRepairPartsArrayModel,ICMBalanceBasicInfoModel;

@protocol ICMBalanceMaintenanceAndPartsViewDelegate <NSObject>
@optional
- (void)showRepairEventAndSearchViewWithRepairType:(NSString *)repairType;

- (void)getMaintenanceAndPartsDiscountModeData:(NSString *)ownerCode WithPS:(NSString *)ps WithType:(int)type;

@end


@interface ICMBalanceMaintenanceAndPartsView : UIView

@property (nonatomic, strong) ICMTitleTextFeildView *workingUnitPriceView;
@property (nonatomic, strong) ICMTitleTextFeildView *workingPriceView;
@property (nonatomic, strong) ICMTitleTextFeildView *partsPriceView;
@property (nonatomic, strong) ICMTitleTextFeildView *totalPriceView;

@property (nonatomic, strong) ICMTitleTextFeildView *discountModeView;
@property (nonatomic, strong) ICMTitleTextFeildView *workingRatioView;
@property (nonatomic, strong) ICMTitleTextFeildView *partsRatioView;
@property (nonatomic, strong) ICMTitleTextFeildView *discountedPrice;

@property (nonatomic, weak) id<ICMBalanceMaintenanceAndPartsViewDelegate> delegate;

@property (nonatomic, strong) NSMutableArray *repairEventArray;

@property (nonatomic, strong) NSMutableArray *repairPartsArray;

@property (nonatomic, strong) NSMutableArray *repairTypes;

@property (nonatomic, strong) NSString *workingPrice;
@property (nonatomic, strong) NSString *workingTime;

@property (nonatomic, strong) NSString *selectedRepairType;

@property (nonatomic, strong) UITableView *repairEventTableView;

@property (nonatomic, strong) UITableView *repairPartsTableView;

@property (nonatomic, strong) TPKeyboardAvoidingScrollView *backgroundScrollView;

@property (nonatomic, strong) ICMRepairEventAndPartSearchViewController *reapsvc;

@property (nonatomic, strong) NSMutableArray *disArray;
@property (nonatomic, strong) NSMutableArray *firstArray;

//自己的打折权限
@property (nonatomic, assign) double myLabourDisLimit;
@property (nonatomic, assign) double myPartDisLimit;

//别人的打折权限
@property (nonatomic, assign) double otherLabourDisLimit;
@property (nonatomic, assign) double otherPartDisLimit;

//是否首保
@property (nonatomic, assign) BOOL isFirstInsurance;
@property (nonatomic, strong) UILabel *firstInsuranceeLabel;
@property (nonatomic, strong) NSString *SB_PRICE;

@property (nonatomic, strong) ICMLevelView *levelView;

@property (nonatomic, strong) NSString *tureVauleLabourDis;
@property (nonatomic, strong) NSString *tureVaulePartDis;

@property (nonatomic, strong) UIView *blankView;


//授权人no
@property (nonatomic, strong) NSString *levelNo;

//界面值是否改变
@property (nonatomic, assign) BOOL hasViewValueChanged;

+ (instancetype)createICMMaintenanceAndPartsViewWithFrame:(CGRect)frame;

//编辑模式调用
- (void)setupPartsViewWithBasicModel:(ICMBalanceBasicInfoModel *)basicModel;
- (void)setupPartsViewWithRepairMaintenancesModel:(ICMRepairMaintenancesModel*)repairMaintenancesModel;
- (void)setupPartsViewWithRepairPartsArrayModel:(ICMRepairPartsArrayModel*)repairPartsArrayModel;
- (void)refreshInEditType;
- (void)calculateRatioPrice;
@end
